<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>制作推广二维码</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" href="/static/aui/css/css/amazeui.min.css">
    <link rel="stylesheet" href="/static/aui/css/css/app.css">
    <script type='text/javascript' src='http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js'></script>
    <script type="text/javascript" src="http://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
</head>
<style>
    .myapp-login .myapp-login-form .am-form .am-form-group input {
        font-size: 14px;
        padding: 10px 0;
        background: none;
        border: none;
        text-align: left;
        border-bottom: 1px solid black;
        color: black;
    }

    .myapp-login .myapp-login-form .am-form button {
        background: #367FFF;
        width: 100%;
        border-radius: 30px;
        color: #fff;
        border: none;
        font-size: 14px;
        margin-top: 20px;
    }

    input:focus {
        font-size: 14px !important;
        padding: 10px 0 !important;
        background: none !important;
        border: none !important;
        text-align: left !important;
        border-bottom: 1px solid black !important;
        color: black !important;
    }

    #qrcodeBox {
        width: 100%;
        height: 100%;
        text-align: center;
        align-content: center;
        display: none;
    }

    #qrcode {
        width: 200px;
        margin: 0 auto
    }

    .tipWindow {
        display: none;
        width: 100%;
        height: 100%;
        position: fixed;
        left: 0;
        top: 0;
        right: 0;
    }

    .tipMain {
        width: 14rem;
        height: 8rem;
        background: rgba(0, 0, 0, .81);
        border-radius: .5rem;
        position: absolute;;
        left: 50%;
        margin-left: -7rem;
        top: 50%;
        margin-top: -4rem;
    }

    .tiptitle {
        padding: 1.5rem .5rem;
        overflow: hidden;
        min-height: 2rem;
        font-size: .8rem;
        line-height: 1rem;
        border-bottom: 1px solid #fff;
        text-align: center;
        color: #fff;
    }

    .erro .tipMain {
        height: 6rem;
    }

    .erro .tipMain .tiptitle {
        padding: 1rem .5rem;
        overflow: hidden;
        min-height: 1rem;
        font-size: .8rem;
        line-height: 1rem;
        border-bottom: 1px solid #fff;
        text-align: center;
        color: #fff;
    }

    .knowbtn {
        display: block;
        text-align: center;
        font-size: .875rem;
        color: #fff;
        line-height: 3rem;
    }

    .knowbtntitles {
        display: block;
        text-align: center;
        font-size: .875rem;
        color: #666;
        line-height: 3rem;
        font-size: 26px;
    }

</style>
<body>
<div class="am-g myapp-login">
    <div class="myapp-login-bg">
        <div class="myapp-login-logo">
            <img style="width:95px;height: 95px; " src="/static/aui/css/css/logos.jpg">
        </div>
        <div class="am-u-sm-10 myapp-login-form" style="margin-top: 0px;">
            <div class="am-form">
                <fieldset>
                    <input type="hidden" id="phone" name="phone" value="{$phone}">
                    <a href="/index.php/member/Login/register" class="knowbtntitles"> ◀去注册？</a>
                    <div id="qrcodeBox">
                        <h1>您可以分享二维码啦</h1>
                        <div id="qrcode"></div>

                    </div>
                </fieldset>
            </div>
        </div>
    </div>

</div>


<div class="tipWindow resphone">
    <div class="tipMain">
        <div class="tiptitle">填写正确的手机号码!</div>
        <div class="knowbtn" id="knowbtnhone">我知道了</div>
    </div>
</div>
<div class="tipWindow outsrcf">
    <div class="tipMain">
        <div class="tiptitle">验证码必填!</div>
        <div class="knowbtn" id="knowbtsrcf">我知道了</div>
    </div>
</div>

<div class="tipWindow outerr">
    <div class="tipMain">
        <div class="tiptitle">验证码必填!</div>
        <div class="knowbtn" id="knowbterr">我知道了</div>
    </div>
</div>
<div class="tipWindow outcsrferr">
    <div class="tipMain">
        <div class="tiptitle">您还没有注册过或验证码错误!</div>
        <div class="knowbtn" id="knowbtcsrferr">我知道了</div>
    </div>
</div>
<div class="tipWindow outregisterr">
    <div class="tipMain">
        <div class="tiptitle">您还没有注册过或验证码错误!</div>
        <div class="knowbtn" id="knowbtregisterr">我知道了</div>
    </div>
</div>
</body>
</html>
<!--[if (gte IE 9)|!(IE)]><!-->
<script src="/static/aui/css/js/jquery.min.js"></script>
<!--<![endif]-->
<!--[if lte IE 8 ]>
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="/static/aui/assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
<script src="/static/aui/css/js/amazeui.min.js"></script>
<script src="/static/aui/css/js/app.js"></script>
<script>

    function init(url) {

        var url = 'https://timethree-test.ssjtime.cn/index.php/member/Login/register/referrer_phone/' + url;
        jQuery('#qrcode').qrcode({width: 200, height: 200, text: url});
    }

    $("#downloadQrcode").click(function () {
        var canvas = $('#qrcode').find("canvas").get(0);
        var url = canvas.toDataURL('image/jpeg');
        $("#download").attr('href', url).get(0).click();

        return false;
    });
</script>
<script>
    var phone = $('#phone').val().replace(/\s+/g, ""); //获取输入手机号
    init(phone);

    $("#knowbtsrcf").click(function () {
        $(".outsrcf").fadeOut();
    });
    $("#knowbtnhone").click(function () {
        $(".resphone").fadeOut();
    });
    $("#knowbterr").click(function () {
        $(".outerr").fadeOut();
    });
    $("#knowbtcsrferr").click(function () {
        $(".outcsrferr").fadeOut();
    });
    $("#knowbtregisterr").click(function () {
        $(".outregisterr").fadeOut();
    });

    var sends = {
        checked: 1,
        send: function () {
            if (sends.checked == 1) {
                var numbers = /^1\d{10}$/;
                var val = $('#phone').val().replace(/\s+/g, ""); //获取输入手机号码
                if ($('.yzm span').attr('class') == 'send1') {
                    if (!numbers.test(val) || val.length == 0) {
                        //$('.div-phone').append('<span class="error">手机格式错误</span>');
                        $(".resphone").fadeIn();
                        return false;
                    }
                }
                if (numbers.test(val)) {
                    var time = 30;
                    var timer;

                    function timeCountDown() {
                        if (time == 0) {
                            clearInterval(timer);
                            $('.yzm span').addClass('send1').removeClass('send0').html("发送验证码");
                            sends.checked = 1;
                            return true;
                        }
                        $('.yzm span').html(time + "S后发送");
                        sends.checked = 0;
                        time--;
                        return false;
                    }

                    //ajax请求验证码
                    $.ajax({
                        type: "POST",
                        url: "index.php?s=/Home/AppRegister/maim_message",
                        data: {phone: val},
                        dataType: "json",
                        success: function (data) {
                            if (data.code == 2620) {
                                $('.yzm span').addClass('send0').removeClass('send1');
                                timeCountDown();
                                timer = setInterval(timeCountDown, 1000);
                            } else {
                                alert(data.msg);
                            }
                        }
                    });


                }
            }
        }
    }
</script>
<script type="text/javascript">
    function generateQRCode(rendermethod, picwidth, picheight, url) {
        $("#qrcode").qrcode({
            render: rendermethod, // 渲染方式有table方式（IE兼容）和canvas方式
            width: picwidth, //宽度
            height: picheight, //高度
            text: url, //内容
            typeNumber: -1, //计算模式
            correctLevel: 2, //二维码纠错级别
            background: "#ffffff", //背景颜色
            foreground: "#000000" //二维码颜色
        });
    }


</script>